package com.zhifa.graph;

import java.util.List;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * @version V1.0
 * @Copyright - Powered By 基础软件开发部
 * @author: liangzhifa
 * @date: 2022/4/24 9:05
 * @Description: 有向图接口
 */
public interface OrientedGraph<V> {

    //最大可用的CPU核数
    int PROCESSORS = Runtime.getRuntime().availableProcessors();
    //线程最大的空闲存活时间，单位为秒
    int KEEPALIVETIME = 60;
    //任务缓存队列长度
    int BLOCKINGQUEUE_LENGTH = 1024;

    ThreadPoolExecutor GRAPHEXECUTOR = new ThreadPoolExecutor(
            PROCESSORS * 2, PROCESSORS * 4, KEEPALIVETIME, TimeUnit.SECONDS
            , new ArrayBlockingQueue<Runnable>(BLOCKINGQUEUE_LENGTH)
    );

    /**
     * 添加节点
     */
    void addNode(V node);

    /**
     * 添加边
     */
    void addEdge(Edge<V> edge);


    /**
     * 显示
     */
    void show();


    /**
     * 广度优先遍历
     */
    void BFSGraph();

    /**
     * 广度优先遍历
     */
    void BFSGraph(V root, List<V> visitedList);


}

